<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>添加资源文件</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<jsp:include page="../public/publicJs.jsp" flush="false"></jsp:include>
<script src="<%=basePath%>js/validator.js"></script>
<script language="javascript">
function exportIn(){
	document.getElementById("myLoad").innerHTML = "";
  	if(document.getElementById("fileControl").value == ""){
  		document.getElementById("myLoad").innerHTML = "<font color=red>未选择文件!</font>";
  		return false;
  	}
    if(checkData(document.forms[0])){
	    document.getElementById("myLoad").innerHTML = "<font color='#FF0000'><img src='<%=basePath%>images/loading.gif' alt='文件上传中' class='icon1' align='absmiddle'/> 文件上传中,请稍后......</font>";
		document.forms[0].encoding = "multipart/form-data";
		document.forms[0].submit();
		return true;
	}else return false;
}
var flag = false;
function callback(msg){
	if(msg != ""){
	  	document.getElementById("myLoad").innerHTML = "<font color=red>"+msg+"</font>";
	  	flag = true;
	}
	unLock();
}

function winClose(){
	if(flag){
		opener.location.reload();
	}
	window.close();
}
</script>
</head>
<body text="#000000" bgcolor="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0"	style="overflow-y:hidden;border:1px solid #8DB2E3;">
<form action="<%=basePath%>ad.crm?method=add" method="post" name="form1" target="hidden_frame">

<table class="title_top" width=100% height="100%" align=center border="0" cellspacing="0" cellpadding="0">
	<tr valign="top" class="tree_title_txt">
		<td class="tree_title_txt" width=100% height=26 align=center valign="middle">广告添加</td>
	</tr>
	<tr valign="top">
	<td>
<div class="tabBody" style="margin:12px;padding:12px;height:80%">
   <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0" class="maintab_content_table">
     <tr>
		<td width="18%"><nobr>标题：</nobr></td>
		<td width="82%"><input type="text" name="title" class="text" style="width:250px" maxB="100" Require="true"/>&nbsp;<span class="biTian">*</span></td>
	 </tr>

	<tr>
		<td width="18%"><nobr>链接地址：</nobr></td>
		<td width="82%"><input type="text" name="linkUrl" class="text" style="width:250px" maxB="200" Require="true" value="http://"/>&nbsp;<span class="biTian">*</span></td>
	 </tr>

	<tr>
       <td valign="top">文件：</td>
       <td><input id="fileControl" name="fileControl" type="file" class="text" style="width:250px" Require="true">&nbsp;<span class="biTian">*</span>&nbsp;文件名不能重复</td>
     </tr>

	 <tr>
	 	<td colspan="2" align="left">
	 		<table border="0" cellSpacing="0" cellPadding="0" id="table13" width="100%">
	 			<tr><td width="50%" align="left"><div id="myLoad" style="text-align:left width:100%"></div></td></tr>
	 		</table>
	 	</td>
	 </tr>
  </table>

  <iframe name='hidden_frame' id="hidden_frame" style='display:none'></iframe>

</div>
<div style="margin:12px" align="right">
	<input name="bup" type="button" value="添加" class="btn3_mouseout" onClick="exportIn()" style="margin-right:0px">
	&nbsp;&nbsp;
	<button onClick="winClose()" class="btn3_mouseout">关闭</button>
</div>
</td></tr>
</table>

<div id="ly" style="position:absolute;top:0px; filter:alpha(opacity=60); background-color:#777; z-index:2; left:0px; display:none"></div>
<div id="Layer2" align="center" style="display:none; background:#fff; width:160px;height:20px;left:40%;top:40%;position:absolute; padding: 5px 5px 5px 5px; z-index:3; filter:alpha(opacity=60);">
<font color="#FF0000" style="font-size:12px"><img src="<%=basePath%>images/loading.gif" class="icon1"  border="0" align="absmiddle"/> 数据保存中,请稍后...</font>
</div>
<script language="javascript">unLock();</script>
</body>
</html>